package com.wits.qso.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;

import net.sf.json.JSONObject;

import com.wits.platform.entity.BaseEntity;

@Entity
@Table(name="qso_grade")
public class Grade extends BaseEntity {

	
	/**
	 * serialVersionUID
	 */
	private static final long serialVersionUID = -5818365586124474690L;

	/** 年级编号 **/
	private String gradeId;
	
	/** 年级  **/
	private String gradeTitle;	
	
	@Id
	@GenericGenerator(name = "idGen", 
					strategy = "com.wits.platform.common.id.generator.IDGenerator",
					parameters={ 
								@Parameter(name = "segment_value", value = "QSO_GRADE_ID"), 
								@Parameter(name="table_name",value="wits_id_generator"),
								@Parameter(name="value_column_name",value="gen_value"),
								@Parameter(name="segment_column_name",value="gen_name"),
								@Parameter(name="segment_value_length",value="5"),
								@Parameter(name="sq_format",value="%03d"), 
								@Parameter(name="sq_prefix",value="GR") 
					})
	@GeneratedValue(generator = "idGen")
	@Column(name = "grade_id", nullable = false, insertable = true, updatable = false, length = 5)
	public String getGradeId() {
		return gradeId;
	}

	public void setGradeId(String gradeId) {
		this.gradeId = gradeId;
	}
	
	@Column(name="grade_title",length=50)
	public String getGradeTitle() {
		return gradeTitle;
	}

	public void setGradeTitle(String gradeTitle) {
		this.gradeTitle = gradeTitle;
	}

	@Override
	public String display() {
		// TODO Auto-generated method stub
		return null;
	}
	
	@Override
	public String toString(){
		return JSONObject.fromObject(this,Grade.getBaseJsonConfig()).toString();
	}
}
